home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Sample Code / Music Architecture / Embedding Instruments / BigEasy / BigEasyPPC.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-05-21  |  4.3 KB  |  151 lines  |  [TEXT/KAHL]

  1. /*
  2.     File:        BigEasyPPC.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Written by:    xxx put writers here xxx
  7.  
  8.     Copyright:    © 1992 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <1>     1/20/92    dvb        first checked in
  13.  
  14. */
  15.  
  16. /* file: BigEasyPPC.h
  17.  *
  18.  * Started Mid 1991, more or less.
  19.  *
  20.  * A set of routines to quickly
  21.  * access some simple uses of PPC.
  22.  *
  23.  */
  24.  
  25.  
  26. #ifndef _BigEasyPPC_
  27. #define _BigEasyPPC_
  28.  
  29.  
  30. /*--------------------------
  31.     Inclusions
  32. --------------------------*/
  33.  
  34. #include <PPCToolbox.h>
  35.  
  36.  
  37. /*--------------------------
  38.     Types
  39. --------------------------*/
  40.  
  41. #define kEasyPPCWritePacketCount 20    /* maximum number of packets waiting to be sent */
  42. #define kEasyPPCClientCount 10        /* most number of connections to one port */
  43.  
  44. /*
  45.  * Each client connected to an Easy Port
  46.  * has one of these records, stored in an
  47.  * array in a handle.
  48.  */
  49. typedef struct
  50.     {
  51.     Boolean used;                    /* is this client structure available? */
  52.  
  53.     Boolean waitingToConnect;        /* Ready to accept a connection? */
  54.     Boolean waitingToReadLength;
  55.     Boolean waitingToReadData;
  56.  
  57.     Str32 userName;
  58.     PPCPortRec portName;            /* port of who we're connected to */
  59.     LocationNameRec locationName;    /* location of who we're connected to */
  60.     long sessRefNum;
  61.     long waitingDataSize;            /* If a message is about to arrive, how big? */
  62.  
  63.     PPCInformPBRec ipbr;
  64.     PPCReadPBRec rpbr;
  65.     long tinyBuffer;                /* So we don't to 0-length reads for length */
  66.     } EasyPPCClient;
  67.  
  68. typedef struct
  69.     {
  70.     Boolean used;
  71.     PPCWritePBRec wpbr;
  72.     void *buffer;                    /* if non-zero, then BigEasy owns it, and should dispose it */
  73.     } EasyPPCWritePB;
  74.  
  75. typedef struct
  76.     {
  77.     long portRefNum;                /* this port's refNum */
  78.     long type;                        /* this port's type */
  79.     long serverType;                /* type of server to connect to; must be different for password use */
  80.     Str32 userName;                    /* this computer's user name */
  81.  
  82.     unsigned short fairSeed;        /* to rotate among what we check first */
  83.     unsigned short fairClient;        /* to rotate amongst the clients */
  84.     long connected;                    /* Count of how many we're connected to */
  85.     EasyPPCClient client[kEasyPPCClientCount];    /* An array of clients */
  86.  
  87.     unsigned short fairWrite;        /* to rotate amongst the outgoing messages */
  88.     long waitingToWrite;            /* Count of outstanding messages */
  89.     EasyPPCWritePB wpbr[kEasyPPCWritePacketCount];    /* An array of outgoing msgs */
  90.  
  91.     } EasyPPCSessionRecord;
  92.  
  93. typedef EasyPPCSessionRecord *EasyPPCSession;
  94.  
  95.  
  96. typedef enum
  97.     {
  98.     easyPPCSessionMessageWaiting = 2,        /* param is length of message */
  99.     easyPPCSessionMessageRead,                /* we read our message, param is 'more' boolean */
  100.     easyPPCSessionMessageWritten,            /* our message sent, no param */
  101.     easyPPCSessionJustConnected,            /* our letConnect was taken, no param */
  102.     easyPPCSessionIdle,                        /* nothing doing */
  103.     easyPPCSessionOtherPortGone,            /* someone left us */
  104.     easyPPCSessionTooManyConnections        /* can't connect if too many! */
  105.     };
  106.  
  107.  
  108. typedef struct
  109.     {
  110.     short operation;            /* member of enum above */
  111.     short error;                /* error, if any */
  112.     long sessRefNum;            /* which session this pertains to */
  113.     long packetType;            /* on a read or write, the packet type */
  114.     long length;                /* on a message-waiting, the length waiting */
  115.     void *buffer;                /* buffer location, on a message-written */
  116.     } EasyPPCPollResult;
  117.  
  118. /*--------------------------
  119.     Prototypes
  120. --------------------------*/
  121.  
  122. EasyPPCSession NewEasyPPCSession(StringPtr name,OSType type);
  123.  
  124. void DisposeEasyPPCSession(EasyPPCSession es);
  125.  
  126. OSErr ConnectEasyPPCSession(EasyPPCSession es,
  127.         LocationNameRec *locationName,PortInfoRec *pir,long *sessRefNum);
  128.  
  129. OSErr DisconnectEasyPPCSession(EasyPPCSession es,long sessRefNum);
  130.  
  131. OSErr LetConnectEasyPPCSession(EasyPPCSession es);
  132.  
  133. OSErr WriteEasyPPCSession(EasyPPCSession es,long sessRefNum,
  134.         long packetType,void *buffer,long length,Boolean easyManage);
  135.  
  136. OSErr ReadEasyPPCSession(EasyPPCSession es,long sessRefNum,void *buffer,long length);
  137.  
  138. void PollEasyPPCSession(EasyPPCSession es,EasyPPCPollResult *pollResult);
  139.  
  140. OSErr BrowseAndConnectEasyPPCSession(EasyPPCSession es,
  141.         StringPtr prompt, StringPtr applListLabel,long *sessRefNum,
  142.         LocationNameRec *location,PortInfoRec *portInfo);
  143.  
  144. void FindNamesEasyPPCSession(EasyPPCSession es,long sessRefNum,
  145.         StringPtr zoneName,StringPtr macName,StringPtr portName);
  146.  
  147. void SetServerTypeEasyPPCSession(EasyPPCSession es,OSType serverType);
  148.  
  149.  
  150. #endif _BigEasyPPC_
  151.